<?php

include '../../configs/global.php';
$data = $_POST;
$number = $data['name'];
$password = $data['password'];

//定义一个返回数组
$ajax_res = array();

$sql="select * from admin where number='$number'";

$row=$pdo->getOne($sql);

if(!$row){
	$password=md5($password);
	$sql="insert into admin(number,password) values('{$number}','{$password}')";
	$r1=$pdo->exec($sql);
	if($r1){
        header('location:/study/style/skip.php?url=admin/addadmin.php&info=添加成功！');
	}else{
        header('location:/study/style/skip.php?url=admin/addadmin.php&info=注册失败,请稍后再试!');
	}
}else{
    header('location:/study/style/skip.php?url=admin/addadmin.php&info=用户已存在！');
}
echo json_encode($ajax_res);